# -*- coding: utf-8 -*-
# @Time    : 2021/1/14 10:23
# @Author  : DuJiabao
# @Project : BaoZaiFanYiWuJianCe
# @FileName: LogThread.py
# @Software: PyCharm
# @Desc    : 
# 用来处理日志的线程
import datetime
from GlobalStatement import *
import os


def log_info(name, delay_main):
    """
    打印日志的线程
    :param name:
    :param delay_main:
    :return:
    """
    x = datetime.datetime.now()
    file_name = str(x.strftime('%Y-%m-%d')) + '.txt'
    if not os.path.exists(log_dir):
        os.mkdir(log_dir)

    while True:
        msg = log_message_queue.get()
        try:
            with open((log_dir + '/' + file_name), 'a') as f:
                f.write('\n')
                f.write(msg)
        except Exception as e:
            print(str(e))


if __name__ == "__main__":
    pass
